package giit.computerbase.server;

import giit.computerbase.dao.SQL;
import giit.computerbase.dao.SQLFactory;
import giit.computerbase.util.Application;

import java.util.ArrayList;
import java.util.HashMap;

/**
 * User: tum0r
 * Package Name: giit.computerbase.server
 * Time: 2018/11/12 Monday 18:08:56
 */
public class UserTypeServer {
    private SQL sql;

    public UserTypeServer() {
        try {
            sql = SQLFactory.getSQL();
            sql.open((String) Application.getConfig().databaseConfig.get("address"),
                    (int) Application.getConfig().databaseConfig.get("port"),
                    Application.DATABASE_NAME,
                    (String) Application.getConfig().databaseConfig.get("encode"),
                    (String) Application.getConfig().databaseConfig.get("user"),
                    (String) Application.getConfig().databaseConfig.get("password"));
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }

    public ArrayList<HashMap<String, Object>> getUserType() {
        return sql.query("select * from user_type", null);
    }
}
